﻿Namespace UI.Converters
	Public Class SolidColorBrushToAccentConverter
		Implements IValueConverter

		Public Function Convert(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.Convert
			Try
				Dim brush As New SolidColorBrush
				brush.Color = CType(value, SolidColorBrush).Color
				brush.Color = Color.FromRgb(Math.Min(brush.Color.R + CInt(parameter), 255), Math.Min(brush.Color.G + CInt(parameter), 255), Math.Min(brush.Color.B + CInt(parameter), 255))	'(brush.Color, CSng(parameter))
				Return brush
			Catch ex As Exception
				Return value
			End Try
		End Function

		Public Function ConvertBack(value As Object, targetType As Type, parameter As Object, culture As Globalization.CultureInfo) As Object Implements IValueConverter.ConvertBack
			Throw New NotImplementedException()
		End Function
	End Class
End Namespace